import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect:"/login"
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/index.vue')
  },
  // 首页路由
  {
    path: '/home',
    name: 'home',
  
    component: () => import('../views/homeview/index.vue'),
    //设置二级路由
    children:[
      {
        path: '/echarts',
        name: 'echarts',
        component: () => import('../views/homeview/HomeChildren/EchartsView.vue'),
        meta: {
          title: "数据展示"
        },
      },
      {
        path: '/permissionlist',
        name: 'permissionlist',
        component: () => import('../views/homeview/HomeChildren/PermissionList.vue'),
        meta: {
          title: "权限列表"
        },
      },
      {
        path: "/user",
        name: "user",
        component: () => import("../views/homeview/HomeChildren/UserOne.vue"),
        redirect:"/userlist",
        meta: {
          title: "住户信息"
        },
        children:[
          {
            path: '/userlist',
            name: 'userlist',
            component: () => import('../views/homeview/HomeChildren/UserList.vue'),
            meta: {
              classifyTitle: "用户信息",//分类标题
              title: "住户列表"
            },
          },
          {
            path: '/userupdate',
            name: 'userupdate',
            component: () => import('../views/homeview/HomeChildren/UserUpdate.vue'),
            meta: {
              classifyTitle: "用户信息",//分类标题
              title: "住户信息修改"
            }
          },
        ]
      },
    ]
  },
  {
    path: "/",
    redirect: "/login"
  }
]

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})
export default router